package org.example.user.controller;



import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.example.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.example.ai.result.Result;


@RestController
@RequestMapping("/users")
@Slf4j
public class UsersController {
    @Autowired
    private UserService userService;
    @Operation(summary = "用户登录注册")
    @PostMapping("/users/loginUser")
    public Result<String> loginUser(String phone, String code){
        return Result.ok(userService.loginUser(phone,code));
    }

    @Operation(summary = "验证码发送")
    @GetMapping("/users/getVerifyCode")
    public Result<String> getVerifyCode( String phone){
        return Result.ok(userService.getVerifyCode(phone));
    }

    @Operation(summary = "确认用户登录状态")
    @GetMapping("/users/getToken")
    public Result<Boolean> getToken(String token){
        return Result.ok(userService.getToken(token));
    }
}
